<?php
namespace app\api\controller;

use app\BaseController;
use app\model\PageConfig as C;
use app\model\system\SystemDict as SD;
use think\facade\Db;
class Config extends BaseController
{
    public function page()
    {
        $banner = (new C())
        ->select()
        ->toArray();
        foreach ($banner as &$v) {
            $v['img'] = $v['img'];
            switch ($v['page_type']) {
                case 1:
                    $v['path'] = '/pages/details/index?id='.$v['item_id'];
                    break;
                case 2:
                    $v['path'] = '/pages/exhibitionDetails/index?id='.$v['item_id'];
                    break;
                case 3:
                    $v['path'] = 'pages/studentDetails/index?id='.$v['item_id'];
                    break;
                default:
                    $v['path'] = '';
                    break;
            }
        }
        return $this->returnApi($banner,0,'成功');
    }

    public function system_config()
    {
        $config = Db::table("lcxx_system_dict")->where("groupid","=", 7)->field("id,name,value")->select()->toArray();
        $res = [
            "config" => $config,
        ];
        return $this->returnApi($res,0,'成功');
    }
}

